<ion-header>
    <ion-navbar core-back-button>
        <ion-title>{{ 'core.grades.grade' | translate }}</ion-title>
    </ion-navbar>
</ion-header>
<ion-content>
    <ion-refresher [enabled]="gradeLoaded" (ionRefresh)="refreshGrade($event)">
        <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
    </ion-refresher>
    <core-loading [hideUntil]="gradeLoaded">
        <core-empty-box *ngIf="!grade" icon="stats" [message]="'core.grades.nogradesreturned' | translate"></core-empty-box>

        <ion-list *ngIf="grade">
            <a ion-item *ngIf="grade.itemname && grade.link" text-wrap detail-push [href]="grade.link" core-link capture="true">
                <ion-icon *ngIf="grade.icon" name="{{grade.icon}}" item-start></ion-icon>
                <img *ngIf="grade.image" [src]="grade.image" item-start class="core-module-icon"/>
                <h2><core-format-text [text]="grade.itemname" contextLevel="course" [contextInstanceId]="courseId"></core-format-text></h2>
            </a>

            <ion-item *ngIf="grade.itemname && !grade.link" text-wrap >
                <ion-icon *ngIf="grade.icon" name="{{grade.icon}}" item-start></ion-icon>
                <img *ngIf="grade.image" [src]="grade.image" item-start class="core-module-icon"/>
                <h2><core-format-text [text]="grade.itemname" contextLevel="course" [contextInstanceId]="courseId"></core-format-text></h2>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.weight">
                <h2>{{ 'core.grades.weight' | translate}}</h2>
                <p [innerHTML]="grade.weight"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.grade">
                <h2>{{ 'core.grades.grade' | translate}}</h2>
                <p [innerHTML]="grade.grade"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.range">
                <h2>{{ 'core.grades.range' | translate}}</h2>
                <p [innerHTML]="grade.range"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.percentage">
                <h2>{{ 'core.grades.percentage' | translate}}</h2>
                <p [innerHTML]="grade.percentage"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.lettergrade">
                <h2>{{ 'core.grades.lettergrade' | translate}}</h2>
                <p [innerHTML]="grade.lettergrade"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.rank">
                <h2>{{ 'core.grades.rank' | translate}}</h2>
                <p [innerHTML]="grade.rank"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.average">
                <h2>{{ 'core.grades.average' | translate}}</h2>
                <p [innerHTML]="grade.average"></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.feedback">
                <h2>{{ 'core.grades.feedback' | translate}}</h2>
                <p><core-format-text [fullTitle]="'core.grades.feedback' | translate" maxHeight="60" fullOnClick="true" [text]="grade.feedback" contextLevel="course" [contextInstanceId]="courseId"></core-format-text></p>
            </ion-item>

            <ion-item text-wrap *ngIf="grade.contributiontocoursetotal">
                <h2>{{ 'core.grades.contributiontocoursetotal' | translate}}</h2>
                <p [innerHTML]="grade.contributiontocoursetotal"></p>
            </ion-item>
        </ion-list>
    </core-loading>
</ion-content>
